﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Business.UploadFileInfo;
using Newtonsoft.Json;

namespace ZLCMS.Web.SystemManage.Control
{
    public partial class JFileControl : System.Web.UI.UserControl
    {
        public JFileControl()
        {
            Config = new UploadConfig();
            FileCountLimit = 5;
            FileDesc = "所有";
            FileFilters = "*.*";
        }

        protected void Page_Load(object sender, EventArgs e)
        {
        }


        /// <summary>
        /// 上传文件基本配置
        /// </summary>
        public UploadConfig Config
        {
            get;set;
        }

        public string FileDesc { get; set; }

        /// <summary>
        /// 文件过滤
        /// </summary>
        public string FileFilters { get; set; }

        /// <summary>
        /// 允许添加的附件最大数量，默认值为 5
        /// </summary>
        public int FileCountLimit { get; set; }

        /// <summary>
        /// 是否只读
        /// </summary>
        public bool Readonly { get; set; }

        /// <summary>
        /// IList<SimpleFileInfo> json value
        /// </summary>
        public string Value
        {
            get { return grid_json.Value; }

            set { grid_json.Value = value; }
        }

        protected string ConfigJSON
        {
            get
            {
                return JsonConvert.SerializeObject(Config);
            }
        }
    }
}